#include<stdio.h>
#include<string.h>
//struct s
//{
//	char name[20];
//	int age;
//}a1,a2;
//
//void my_memcpy(void* des, const void* source, size_t n)
//{
//	int i = 0;
//	while (i-n)
//	{
//		*((char*)des + (char)i) = *((char*)source + (char)i);
//		i++;
//	}
//}
//int main()
//{
//	char num[] = "meili!";
//	my_memcpy(a1.name, num, strlen(num));
//	printf("%s\n", a1.name);
//
//	my_memcpy(a1.name, "wo", 2);
//	printf("%s\n\n", a1.name);
//
//	memcpy(a2.name,a1.name, strlen(num));
//	printf("%s\n\n", a2.name);
//	char stu[] = "giaogiao";
//	memcpy(a2.name, stu, strlen(stu));
//	printf("%s\n", a2.name);
//	printf("%s\n", a1.name);
//}

void my_memmove(void* destination, const void* source, size_t num)
{
	int i = 0;
	while (i - num)
	{
		*((char*)destination + (char)i) = *((char*)source + (char)i)  ;
		i++;
	}
}
int main()
{
	char str1[40] = { 0 };
	char str2[] = "yee,ya li ma si nei";
	my_memmove(str1, str2, strlen(str2));
	printf("%s\n\n", str1);

	char str3[40] = { 0 };
	char str4[] = "yee,ya li ma si nei";
	my_memmove(str3, str4 + 10, strlen(str4));
	printf("%s\n", str3);
	memmove(str3, str4+10, strlen(str4));
	printf("%s\n\n", str3);
	
	char str5[40] = {"NNNNNNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"};
	char str6[] = "yee,ya li ma si nei";
	my_memmove(str5, str6 + 10, strlen(str6));
	printf("%s\n", str5);
	memmove(str5, str6+10, strlen(str6));
	printf("%s\n\n", str5);

	char str7[40] = { "NNNNNNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMM" };
	char str8[] = "yee,ya li ma si nei";
	my_memmove(str7, str8 + 10, strlen(str7));
	printf("%s\n", str7);
	memmove(str7+15, str8 + 10, strlen(str8));
	printf("%s\n\n", str7);
}
